﻿using RedisUtil;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace 订阅者
{
    class Program
    {
        static void Main(string[] args)
        {

            BaseRedis redis = new BaseRedis();

            var channelKey = "SMSChannel";

            var computerId = Guid.NewGuid().ToString("N");

            // 向Redis SMSChannel 管道 注册订阅
            redis.Subscriber.Subscribe(channelKey, (channel, message) =>
            {
                Console.WriteLine($"（{computerId}）接收到来自频道 {channel} 的消息：{message}");
            });

            Console.WriteLine($"{computerId} 订阅了频道：{channelKey}");

            Console.ReadKey();
        }
    }
}
